package com.srcptit.tranning.toannt.btvn1;
import java.util.Scanner;
public class UCLN {
public static void main(String[]args){
	Scanner sc=new Scanner(System.in);
	System.out.println("nhap vao 2 so: ");
	int a=sc.nextInt();
	int b=sc.nextInt();
	System.out.println("UCLN cua 2 so vua nhap la: ");
	System.out.println(ucln(a,b));
}
public static int ucln(int a,int b){
	int n,m;
	if(a>b){
        m = a; n = b;
    }
    else{
        m = b; n = a;
    }
    while(n > 0){
        int tg = m%n;
        m = n;
        n = tg;
    }
    return m;
}
}
